home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / T U R B O Language / Turbo C Tools v6.0 / INCLUDE / BSCREENS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-31  |  10.6 KB  |  269 lines

  1. /**
  2. *
  3. *  BSCREENS.H    Header file for Turbo C TOOLS Screen Functions
  4. *
  5. *  Version 6.00 (C) Copyright Blaise Computing Inc. 1983, 1987-1989
  6. *
  7. **/
  8.  
  9. #ifndef DEF_BSCREENS              /* Prevent second reading of    */
  10. #define DEF_BSCREENS 1              /* these definitions.          */
  11.  
  12. #include <butil.h>
  13.  
  14. #define  SC_BIOS_INT  16          /* BIOS interrupt for screen    */
  15.                       /* functions.              */
  16.  
  17. #define  NORMAL     7              /* Common attributes for the    */
  18. #define  REVERSE    112           /* monochrome adapter          */
  19. #define  UNDERLINE  1
  20. #define  INTENSITY  8
  21. #define  MONOBLINK  128
  22.  
  23. #define  SC_BLACK   0              /* (Byte) values representing   */
  24. #define  SC_BLUE    1              /* color attributes.          */
  25. #define  SC_GREEN   2
  26. #define  SC_CYAN    3
  27. #define  SC_RED     4
  28. #define  SC_MAGENTA 5
  29. #define  SC_BROWN   6
  30. #define  SC_WHITE   7
  31.  
  32.     /* Maximum dimensions of usual PC screens                  */
  33.  
  34. #define  PC_ROWS      25
  35. #define  PC_COLS      80
  36. #define  LAST_ROW     (PC_ROWS - 1)
  37. #define  LAST_COL     (PC_COLS - 1)
  38. #define  PC_BIG_ROWS  50
  39. #define  MAX_DEVICES  2           /* Color and/or monochrome      */
  40. #define  MAX_PAGES    8           /* Pages per video adapter      */
  41.                       /* (8 maximum on EGA)          */
  42.  
  43.     /* Scrolling directions                          */
  44.  
  45. #define  SCR_UP      0
  46. #define  SCR_DOWN    1
  47. #define  SCR_RIGHT   0
  48. #define  SCR_LEFT    1
  49.  
  50.     /* Options for SCPGCUR                          */
  51.  
  52. #define  CUR_ADJUST    1     /* Adjust cursor size into normal       */
  53.                   /* limits if appropriate              */
  54. #define  CUR_NO_ADJUST    0     /* Use requested cursor scan lines      */
  55.                   /* without any adjustment           */
  56.  
  57.     /* Options for writing strings to screen                  */
  58.  
  59. #define  CUR_BEG     0          /* Leave cursor at beginning of string. */
  60. #define  CUR_AFTER   1          /* Leave cursor after end of string.    */
  61.                   /*                      */
  62. #define  CHARS_ONLY  0          /* Buffer contains characters only.     */
  63. #define  CHAR_ATTR   2          /* Buffer contains (char,attr) pairs.   */
  64.                   /*                      */
  65. #define  MOVE_CUR    0          /* Leave cursor according to          */
  66.                   /*   CUR_BEG/CUR_AFTER bit.          */
  67. #define  NO_MOVE_CUR 4          /* Preserve cursor location.          */
  68.  
  69.     /* Options for SCBLINK                          */
  70.  
  71. #define  SC_BLINK    1          /* Attribute bit 7 == foreground blink. */
  72. #define  SC_INTENSE  0          /* Attribute bit 7 == background          */
  73.                   /*   intensity.                  */
  74. #define  SC_INTENSITY  0      /* Synonym for SC_INTENSE.          */
  75.  
  76.     /* Error codes                              */
  77.  
  78. #define  SC_NO_ERROR    0     /* Operation successful.              */
  79. #define  SC_BAD_OPT    1     /* Video adapter does not support this  */
  80.                   /*  operation.                  */
  81. #define  SC_RANGE    2     /* Value out of range or exceeds          */
  82.                   /*  dimension.                  */
  83. #define  SC_NO_MEMORY    3     /* Insufficient memory to perform       */
  84.                   /*  operation.                  */
  85.  
  86.     /* Symbols used by SCEQUIP to indicate the state of the various   */
  87.     /* video adapters                              */
  88.  
  89. #define  SC_DONT_KNOW  (-1)   /* We haven't checked yet               */
  90. #define  SC_ABSENT     (-2)
  91. #define  SC_MONO       0
  92. #define  SC_COLOR      1
  93.  
  94. #define  SC_HIFUNC     2      /* PGC in high-function graphics mode   */
  95.                   /*   (not CGA emulation mode)          */
  96.  
  97. #define  DONT_KNOW   (SC_DONT_KNOW)
  98. #define  ABSENT      (SC_ABSENT)
  99. #define  HIFUNC      (SC_HIFUNC)
  100.  
  101.  
  102.     /* Global variables set by SCEQUIP indicating installed video     */
  103.     /* hardware and switch settings                      */
  104.  
  105. extern int b_mdpa;   /* Monochrome Display & Printer Adapter          */
  106.              /*   SC_DONT_KNOW, SC_ABSENT, or SC_MONO          */
  107.              /*   (SC_MONO if Hercules graphics adapter.)     */
  108.              /*                           */
  109. extern int b_cga;    /* Color/Graphics Monitor Adapter              */
  110.              /*   SC_DONT_KNOW, SC_ABSENT, or SC_COLOR          */
  111.              /*                           */
  112. extern int b_ega;    /* Enhanced Graphics Adapter: SC_DONT_KNOW,      */
  113.              /*   SC_ABSENT, SC_MONO or SC_COLOR          */
  114.              /*                           */
  115. extern int b_mcga;   /* Multicolor Graphics Array: SC_DONT_KNOW,      */
  116.              /*   SC_ABSENT, or SC_COLOR              */
  117.              /*                           */
  118. extern int b_vga;    /* Video Graphics Array                  */
  119.              /*  SC_DONT_KNOW, SC_ABSENT, SC_MONO or SC_COLOR */
  120.              /*                           */
  121. extern int b_herc;   /* Hercules monochrome graphics adapter          */
  122.              /*   SC_DONT_KNOW, SC_ABSENT, or SC_MONO          */
  123.              /*                           */
  124. extern int b_pgc;    /* Professional Graphics Controller:  SC_ABSENT, */
  125.              /*   SC_DONT_KNOW, SC_COLOR or SC_HIFUNC          */
  126.  
  127. extern int b_mem_ega;          /* Amount of memory installed on EGA in */
  128.                   /* 1024-byte units:  64, 128, 256       */
  129.                   /*                      */
  130. extern unsigned b_sw_ega;     /* Switch settings on EGA           */
  131.                   /* Low-order bit set means SW1 off, etc.*/
  132.                   /* (Bit value 1 implies that          */
  133.                   /* corresponding switch is off.)          */
  134.  
  135.     /* Global variables for managing multiple devices & display       */
  136.     /* pages                                  */
  137.  
  138. extern int b_curpage;          /* Current display page              */
  139. extern int b_device;          /* Current adapter:  SC_DONT_KNOW,      */
  140.                   /*   SC_MONO, or SC_COLOR           */
  141.  
  142. extern int b_know_hw;              /* Flag stating whether we have */
  143.                       /* yet run SCEQUIP:  0 if no, 1 */
  144.                       /* if yes.              */
  145.  
  146. typedef struct                  /* CUR_TYPE structure:          */
  147. {                      /* high and low scan lines      */
  148.     int high,low;              /* in a cursor.              */
  149. } CUR_TYPE;
  150.  
  151. typedef struct                  /* CUR_INFO structure:          */
  152. {                      /* State, location and size of  */
  153.     int      off;              /* a cursor.              */
  154.     int      row;
  155.     int      col;
  156.     CUR_TYPE size;
  157. } CUR_INFO;
  158.  
  159.     /* Internal structures for preserving BIOS video variables          */
  160.  
  161. typedef struct
  162. {
  163.     int  known;               /* 1 if this structure has      */
  164.                       /*  valid data, 0 if not.       */
  165.     int  curpage;              /* Copy of b_curpage.          */
  166.                       /*                  */
  167.     char pc_area[30];              /* Standard PC/XT area.          */
  168.     char video_area[7];           /* Some video data.          */
  169.     char far *save_ptr;           /* Pointer to EGA variables.    */
  170.     char prtsc_status;              /* Print screen status byte.    */
  171. } VIDEO_STATE;
  172. extern VIDEO_STATE b_adap_state[2];   /* One entry for SC_MONO, one   */
  173.                       /* for SC_COLOR.              */
  174.  
  175. typedef struct                  /* ADAP_STATE structure:          */
  176. {                      /*   state of the video adapter.*/
  177.     int      mode;              /* Current video mode.          */
  178.     int      act_page;              /* Active (displayed) page.     */
  179.     int      cur_page;              /* Current page.              */
  180.     int      rows, columns;          /* Dimensions of screen.          */
  181.     int      curs_off;              /* Cursor on or off.          */
  182.     CUR_TYPE curs_size;           /* Cursor high & low scan lines.*/
  183. } ADAP_STATE;
  184.  
  185. typedef struct                  /* PAGE_STATE structure:          */
  186. {                      /*   state of the current page. */
  187.     int  curs_row, curs_column;       /* Location of cursor.          */
  188.     char *pimage;              /* Compressed screen image.     */
  189.     int  image_length;              /* Length of compressed image.  */
  190. } PAGE_STATE;
  191.  
  192.     /* Turbo C TOOLS functions implemented as macros              */
  193.  
  194. #define  scpage(page)  (b_curpage = (page))
  195.  
  196.     /* Function declarations                          */
  197.  
  198. char cdecl scequip(void);          /* Sense hardware environment   */
  199.                       /*                  */
  200. int cdecl  scnewdev(int,int);          /* Reset and select 25 or 43    */
  201.                       /* line font              */
  202.                       /*                  */
  203. int cdecl  scchgdev(int);          /* Select adapter           */
  204.                       /*                  */
  205. int cdecl  scmode(int *,int *,int*);  /* Return the video mode info   */
  206.                       /*                  */
  207. int cdecl  scrows(void);          /* Number of rows on screen     */
  208.                       /*                  */
  209. int cdecl  scpages(void);          /* Number of pages in this mode */
  210.                       /*                  */
  211. int cdecl  scapage(int);          /* Display (activate) a page    */
  212.                       /*                  */
  213. void cdecl scpclr(void);          /* Clear the current page       */
  214.                       /*                  */
  215. int cdecl scclrmsg(int,int,int);      /* Clear a message          */
  216.                       /*                  */
  217. int cdecl  sccurset(int,int);          /* Set the cursor position      */
  218.                       /*                  */
  219. int cdecl  scpgcur(int,int,int,int);  /* Alter the cursor size on     */
  220.                       /* current page.              */
  221.                       /*                  */
  222. int cdecl  sccurst(int *,int *,int *, /* Return position & size of    */
  223.            int *);          /* cursor on current page.      */
  224.                       /*                  */
  225. char cdecl scread(int *,int *);       /* Read character and attribute */
  226.                       /*                  */
  227. int cdecl  scattrib(int,int,char,     /* Set the display attributes   */
  228.             unsigned);          /*                  */
  229.                       /*                  */
  230. int cdecl  scwrite(char,unsigned);    /* Write copies of a character  */
  231.                       /*                  */
  232. int cdecl  scttywrt(char,int);          /* Write character TTY-style    */
  233.                       /*                  */
  234. int cdecl  scbox(int,int,int,int,     /* Draw a box              */
  235.          int,char,int);       /*                  */
  236.                       /*                  */
  237. void cdecl scttywin(int,int,int,int,  /* Write character TTY-style to */
  238.           char,int,int,int,int);  /* rectangular region.          */
  239.                       /*                  */
  240. void cdecl scwrap(int,int,int,int,    /* Write to rectangular region  */
  241.       int,const char *,int,int,int);  /* with word wrap           */
  242.                       /*                  */
  243. int cdecl  scblink(int);          /* Choose role of attribute bit */
  244.                       /* 7:  foreground blink or      */
  245.                       /* background intensity.          */
  246.                       /*                  */
  247. int cdecl  scpalett(const char *);    /* Load EGA palette registers.  */
  248.                       /*                  */
  249. int cdecl  scpal1(unsigned,unsigned); /* Load individual EGA palette  */
  250.                       /* register.              */
  251.                       /*                  */
  252. int cdecl  scborder(unsigned);          /* Set screen border color.     */
  253.                       /*                  */
  254. int cdecl  scmode4(int,int);          /* Set mode 4 palette and       */
  255.                       /* background color.          */
  256.                       /*                  */
  257. void cdecl scgetvid(ADAP_STATE *);    /* Get the complete video state.*/
  258.                       /*                  */
  259. int cdecl  scsetvid(const          /* Set the complete video state.*/
  260.             ADAP_STATE *);    /*                  */
  261.                       /*                  */
  262. int cdecl  scsavepg(PAGE_STATE *);    /* Save the current page.       */
  263.                       /*                  */
  264. int cdecl  screstpg(const          /* Restore the current page.    */
  265.             PAGE_STATE *);    /*                  */
  266.                       /*                  */
  267.  
  268. #endif                      /* Ends "#ifndef DEF_BSCREENS"  */
  269.